﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccessLayer
{
    public class AdjustmentDetailRepository
    {
        StationeryInventoryEntities1 ent;

        public AdjustmentDetailRepository()
        {
            ent = new StationeryInventoryEntities1();
        }

        #region Select Method
        public List<AdjustmentDetail> GetAdjustmentDetailByVoucherId(int voucherId)
        {
            List<AdjustmentDetail> list = new List<AdjustmentDetail>();

            var adjDetail = ent.AdjustmentDetails.Where(x => x.AdjVoucherID == voucherId);

            if (adjDetail != null)
            {
                list = adjDetail.ToList();
            }
            return list;
        }

        #endregion

        #region Create Method
        public void CreateAdjustmentDetail(AdjustmentDetail adjustmentDetail)
        {
            ent.AdjustmentDetails.Add(adjustmentDetail);
            ent.SaveChanges();
        }
        #endregion
    }
}
